<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Queue {
            constructor() {
                this.item = [];
            }
            enqueue(element) {
                this.item.push(element);
            }
            dequeue() {
                return this.item.shift();
            }
            peek() {
                if (this.isEmpty()) {
                    return undefined;
                } else {
                    return this.item[0];
                }
            }

        }
    </script>
</body>

</html>